$(document).ready(function()
{
	$(".subbtn").click(function()
	{
		
		var product_category = $('#pcat').val();
		var product_description = $('#pcdesc').val();
		
		var added_on = $('#added_on').val();
		var added_by = $('#added_by').val();
		
		
		var dataString = 'pc='+ product_category + '&pd='+ product_description + '&ao='+ added_on + '&ab='+ added_by + '&ft=addcat';
		
		$.ajax
		({
			type: "POST",
			url: "controller/save.php",
			data: dataString,
			cache: false,
			success: function(html)
			{
			$("#saveResult").html(html);
			setTimeout("location.reload(true);",3000);
			$('#pcat').val('');
			$('#pcdesc').val('');
		} 
		});
	
	});
	
	
	
	
	
	$(".subbtn2").click(function()
			{
	
				var product_category = $('#product_cat').val();
				var product_name = $('#pname').val();
				var product_description = $('#pdesc').val();
				var product_quantity = $('#pquantity').val();
				var product_uom = $('#uom').val();
				var product_size = $('#psize').val();
				var currency = $('#currency').val();
				var product_iprice = $('#iprice').val();
				var product_fprice = $('#fprice').val();
				
				var added_on2 = $('#added_on2').val();
				var added_by2 = $('#added_by2').val();
				
				
				var dataString = 'pc='+ product_category + '&pn='+ product_name+ '&pq='+ product_quantity+ '&pu='+ product_uom+ '&ps='+ product_size+ '&pip='+ product_iprice+ '&pfp='+ product_fprice + '&pd='+ product_description+ '&currency='+ currency+ '&ao2='+ added_on2 + '&ab2='+ added_by2 + '&ft=addproduct';
				
				$.ajax
				({
					type: "POST",
					url: "controller/save.php",
					data: dataString,
					cache: false,
					success: function(html)
					{
					$("#saveResult").html(html);
					$('#product_cat').val('');
					$('#pname').val('');
					$('#pdesc').val('');
					
					$('#pquantity').val('');
					$('#uom').val('');
					$('#psize').val('');
					
					$('#iprice').val('');
					$('#fprice').val('');
					$('#added_on').val('');
					$('#added_by').val('');
				
				} 
				});
	
			});

});
